""" 2_1 GPIO输入：普通按键 """
# https://learn.adafruit.com/adafruit-esp32-s3-tft-feather/digital-input

import board
import digitalio

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

# board.BUTTON 与 board.BOOT0 等同
button = digitalio.DigitalInOut(board.BUTTON)
button.switch_to_input(pull=digitalio.Pull.UP)

# 普通按键
status = False
while True:
    if not button.value:
        if status == False:
            print("按键")
            status = True
            led.value = status
    else:
        status = False
        led.value = status
